package xiaodou.modules
{
	import spark.components.Label;
	import spark.components.SkinnableContainer;
	
	import xiaodou.skins.STitleContainerSkin;
	
	public class TitleContainer extends SkinnableContainer
	{
		[SkinPart(required="true")]
		public var lbTitle:Label;
		
		private var _title:String;
		
		public function TitleContainer()
		{
			super();
			setStyle("skinClass", STitleContainerSkin);
		}
		
		override protected function partAdded(partName:String, instance:Object):void
		{
			super.partAdded(partName, instance);
			if(instance == lbTitle)
			{
				lbTitle.text = _title;
			}
		}
		
		override protected function commitProperties():void
		{
			super.commitProperties();
			lbTitle.text = _title;
		}

		/**
		 * 标题文字 
		 */
		public function get title():String
		{
			return _title;
		}

		/**
		 * @private
		 */
		public function set title(value:String):void
		{
			_title = value;
			invalidateProperties();
		}

	}
}